package io.scnb.lesson001.demo18;

import java.lang.annotation.*;

/**
 * 类可以继承父类上被@Inherited修饰的注解，而不能继承接口上被@Inherited修饰的注解
 */
public class InheritAnnotationTest {

    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    @Inherited
    @interface A1{

    }

    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    @Inherited
    @interface A2 {

    }

    @A1
    interface i1{}
    @A2
    static class C1{}

    static class C2 extends C1 implements i1 {}

    public static void main(String[] args) {
        for (Annotation annotation : C2.class.getAnnotations()) {
            System.out.println(annotation);
        }
    }


}
